<template>
  <div>
    <common-head title="添加联系人"/>
    <div class="content">
      <van-address-edit
        :area-list="areaList"
        show-postal
        show-set-default
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
      />
    </div>
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
import CommonHead from '../../components/CommonHead.vue'
import area from 'utils/area'
import { Toast } from 'vant'
export default {
  data () {
    return {
      areaList: area
    }
  },
  components: { CommonHead },
  methods: {
    onSave (contact) {
      console.log(contact)
      this.add_contact(contact)
      Toast('添加成功')
      this.$router.go(-1)
    },
    ...mapMutations('address', ['add_contact'])
  }
}
</script>

<style lang="scss" scoped>
.content{
  margin-top: 46px;
}
</style>
